<?php
	$id = $_GET["id"];
	$loi[] = "";
	if(isset($_POST["ok"])){
		$u = $p = "";
		if($_POST["user"] == null){
			$loi[] = "Ban chua nhap Usename";
		}else{
			$u = $_POST["user"];
		}
		if($_POST["pass1"] != $_POST["pass2"]){
			$loi[] = "Password chua trung";
		}else{
			if($_POST["pass1"] != null){
				$p = $_POST["pass1"];
			}else{
				$p = "none";
			}
		}
		$lev = $_POST["lev"];
		if($u && $p && $lev){
			$update = new muser();
			$update->setuser($u);
			$update->setpass($p);
			$update->setlevel($lev);
			$update->setid($id);
			if($update->check_user() == false){
				$loi[] = "Tai khoan cua ban da dang ky";
			}else{
				if($p != "none"){
					$update->update();
				}else{
					$update->update1();
				}
				header("location: index.php?module=listuser&action=list");
				exit();
			}
		}
	}
	$show = new muser();
	$data = $show->show($id);
?>
<?php
	require ("views/user/vedit_user.php");
?>